package com.jason.sms.agent;

import java.util.Date;
import java.util.List;

import javax.jws.WebService;

import com.jason.sms.agent.component.SmsComponent;
import com.jason.sms.agent.model.SmsMsg;
import com.jason.sms.agent.util.SmsEntryConstance;

@WebService(targetNamespace=SmsEntryConstance.TargetName,serviceName="SmsService",endpointInterface="com.jason.sms.agent.SmsService")
public class SmsEntry implements SmsService {
	
	private static final int Default_pool_size = 10;
	
	private SmsComponent component;

	public SmsEntry(){
		component = new SmsComponent(Default_pool_size);
		component.startWork();
	}
	

	public void sendSms(String sender,String password,String title,String content,List<String> destAddresses) {
		
		SmsMsg msg = new SmsMsg();
		msg.setSender(sender);
		msg.setPassword(password);
		msg.setContent(content);
		msg.setReceiver(destAddresses);
		msg.setSendDate(new Date());
		msg.setTitle(title);
		component.addMsg(msg);
		
	}

}
